package com.founder.barcode.bussiness.util;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringBussUtil {
    
    private ApplicationContext context = null;
    
    private static SpringBussUtil instance = null;
    
    private SpringBussUtil() {
        context = new ClassPathXmlApplicationContext("classpath*:spring/applicationContext-business.xml");
    }
    
    public static SpringBussUtil getInstance() {
        if(instance == null)
            instance = new SpringBussUtil();
        return instance;
    }
    
    public Object getBean(String name) {
        return context.getBean(name);
    }
    
    public <T> T getBean(String name,Class<T> clazz) {
        return context.getBean(name, clazz);
    }
    
    public Object getBean(String name,Object ...args) {
        return context.getBean(name, args);
    }
}
